#!/usr/bin/env python3

def generate_gitee_url(pkg_name):
    org_name = "agiros"
    return f"https://gitee.com/{org_name}/{pkg_name}"

def get_gitee_urls(isFile=False):
    input_file = "/root/ws/2025/04/agiros_pkg_build_tools/build_tools/output/ros-pkg.list"
    output_file = "/root/ws/2025/04/agiros_pkg_build_tools/gitee_urls.txt"
    
    with open(input_file, 'r') as f:
        lines = f.readlines()
    
    urls = []
    for line in lines:
        # 分割每行并获取第一列（包名）
        pkg_name = line.strip().split()[0]
        url = generate_gitee_url(pkg_name)
        urls.append(url)
    
    if isFile:
        # 将生成的URL写入输出文件
        with open(output_file, 'w') as f:
            for url in urls:
                f.write(f"{url}\n")

    return urls

def main():
    urls = get_gitee_urls(True)
    for url in urls:
        print(url)


if __name__ == "__main__":
    main()